package com.ag.hmk.action;

import com.ag.bean.TbTeam;
import com.ag.hmk.service.impl.TbTeamServImpl;
import com.opensymphony.xwork2.ActionSupport;
/**
 * 
 * @author 黄木看
 * 删除一条救援队伍记录的action
 */
public class DelTeamAction extends ActionSupport {
	
	private static final long serialVersionUID = -3176643833644768279L;
	private TbTeamServImpl tbTeamServImpl;
	
	private String teamID; //将要删除的队伍ID
	private String delStr; //返回页面结果，1表示删除成功，0表示删除不成功.
	
	/*
	 * 删除一条记录（救援队伍即：TbTeam）
	 */
	public String delTeam()throws Exception {
		try {
			this.setDelStr("0");
			TbTeam delTeam = tbTeamServImpl.findTeamByID(teamID);
			if (delTeam!=null) {
				tbTeamServImpl.delTeam(delTeam);
				this.setDelStr("1");
			} else {
				this.setDelStr("0");
			}
		} catch (Exception e) {
			e.printStackTrace();
			this.setDelStr("0");
		}
		
		return "delTeamOK";
	}

	public void setTbTeamServImpl(TbTeamServImpl tbTeamServImpl) {
		this.tbTeamServImpl = tbTeamServImpl;
	}

	public void setTeamID(String teamID) {
		this.teamID = teamID;
	}

	public String getDelStr() {
		return delStr;
	}

	public void setDelStr(String delStr) {
		this.delStr = delStr;
	}

}
